Skip to content

feat(cli): allow arbitrary project structure for LibDeploy and system types#309

Closed
dk1a wants to merge 2 commits into
latticexyz:mainfrom
dk1a:dk1a/subdirs
Closed

feat(cli): allow arbitrary project structure for LibDeploy and system types#309
dk1a wants to merge 2 commits into
latticexyz:mainfrom
dk1a:dk1a/subdirs

Conversation

@dk1a

@dk1a dk1a commented Jan 2, 2023

Copy link
Copy Markdown
Contributor

#311 would help with highlighting for Vm, but isn't required.

Removes the need for systems to be in src/systems or components in src/components.
src is taken from foundry.toml, names are taken from deploy.json, and then relative paths are built accordingly.
The new requirement is to just not have 2 identically named files (in different folders) for 1 system/component.
This should work fine with most (probably all) existing project structures, but also allows changing them.

The main things that changed are:

  • generateLibDeploy and its dependents (like codegen-libdeploy, deploy-contracts, deploy, test)
  • generateSystemTypes and its dependents (types, system-types, deploy-contracts, deploy)
  • test's handler and generateAndDeploy generate LibDeploy in test dir from forgeConfig (which by default is test, not src/test. Not really a breaking change, but a change. Is it bad?)
  • deploy copies Deploy.sol script to test dir along with LibDeploy.

TODO for a followup:

  • hsr.ts: tracking uses system folder only, so only works with the old structure; default root should come from getForgeConfig instead of a hardcoded argument
  • trace.ts: hardcoded /src/components/ etc

@dk1a dk1a force-pushed the dk1a/subdirs branch 2 times, most recently from 5910b35 to 8df2b31 Compare January 2, 2023 21:42
@dk1a dk1a marked this pull request as ready for review January 5, 2023 23:58
@dk1a dk1a requested a review from alvrs as a code owner January 5, 2023 23:58
@dk1a

dk1a commented Jan 6, 2023

Copy link
Copy Markdown
Contributor Author

I'll be testing it for a while longer, but I removed dependencies, it seems to work, and should be ready for a general review

@dk1a

dk1a commented Feb 5, 2023

Copy link
Copy Markdown
Contributor Author

added support for initializer libs,
improved Deploy.sol generation and made it work better with tests

another emojimon branch to test that it works with current projects (gotta link it locally). Basically the only things that would change are local LibDeploy+Deploy

@dk1a

dk1a commented Feb 10, 2023

Copy link
Copy Markdown
Contributor Author

Closing for now, parts of it will be in a separate PR, the rest will PR to v2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant